//变量
var img = {'1':'餐饮','2':'体育','3':'其它'};
var smallImg = {'0':'../themes/default/images/ico_num01.gif','1':'../themes/default/images/ico_num02.gif','2':'../themes/default/images/ico_num03.gif'};
//图片滚动展示 Start
var counts = 3;
//大图/
var img = {'1': '../themes/default/images/upload/gg02.jpg','2': '../themes/default/images/upload/gg02.jpg','3':''}; 
var url = {'1': 'http://www.cuniao.com/','2': '../themes/default/images/upload/gg02.jpg','3':''}; 
var nn = 1;
var key = 0;
//var timename=setInterval("Comm.queryhint();",5000); 
Comm = {
	/***********************************/
	/*************DB取数据**************/
	/***********************************/
	//逛页面 推荐活动
	guangAct : function(el){
		Jes.query('officialact_query_sql@idx',{isLoad:false,isSess:0},function(data){
			var html = '';
			for(var i=0;i<data.length;i++){
				if(i==data.length-1){
					html += Comm._guangActHtml(data[i],true);
				}else{
					html += Comm._guangActHtml(data[i],false);
				}
			}
			document.getElementById(el).innerHTML = html;
		});
	}
	/**
	*发现活动
	* el divid / param 包含以下
	* city 城市
	* createrType 0官方1用户2商家
	* actpro 1公开或2私人
	* creater 1我的好友  2我的间接好友
	* acttype 活动标签
	* starttime,endtime  活动开始结束时间
	**/
	,findAct : function(el,param,page,pageSize){
		var page = page || 1,pageSize = pageSize|| 15;
		Jes.page('findact_query_sql@idx',{paraObj:param,isLoad:false,page:page,pageSize:pageSize,isSess:0},function(data){
			var html = '';
			var data=data.pageList;
			Cn_Index._TOPICDATA = data;
			for(var i=0;i<data.length;i++){
				html += Comm._actHtml(data[i],i);
			}
			document.getElementById(el).innerHTML = html;
			var html = Jes.Page.html(data,'1');
			Jes.html('all_page',html);
		});
	}
	//发送簇鸟号到手机
	,sendActkey : function(content,phones){
		if(phones.length<11)alert('绑定手机号码不对！');
		//发送号码到手机
		Jes.doSaveTObject('cn.sendphones', {param: {phones: phones,content:content},isLoad:false}, function(data) {
			if(data==true){
				Jes.alert('发送成功');
			}
        });
	}
	
	/**发现商家
	* el  divid
	* afteraction  关注之后的动作
	*/
	,findBus : function(el,param,page,pageSize,afterAction){
		var page = page || 1,pageSize = pageSize|| 15;
		Jes.page('findbus_query_sql@idx',{paraObj:param,isLoad:false,'isSess':0,page:page,pageSize:pageSize},function(data){
			var html = '';
			var data=data.pageList;
			html = '<table width="100%" border="0" cellpadding="0" cellspacing="0" >';
			for(var i=0;i<data.length;i++){
				var doub = (i+1)%2?false:true;
				if(!doub){html += '<tr>';}
				html += Comm._busHtml(data[i],afterAction);
				if((i+1)==data.length||doub){html += '</tr>';}
			}
			html += '</table>';
			Jes.html(el,html);
			var html = Jes.Page.html(data,'1');
			Jes.html('all_page',html);
		});
	}
	//个人信息中心
	,queryCenter : function(userid){
		if(userid==null||userid=='')userid=userInfo.userid;
			Jes.query('cnucenter_query_sql@idx',{paraObj:"{userid:'"+ userid +"'}",isLoad:false,'isSess':0},function(data){
				data = data[0];
				Jes.setFormValue("form1",data);
			});
	}
	//显示通知
	,queryhint : function(){
		if(Jes.userSess()){
			Comm.toptip();
			Jes.query('cnucenter_query_sql@idx',{paraObj:"{userid:'"+userInfo.userid+"'}",isLoad:false},function(data){
				data = data[0];
				var html = [];
				Jes('topnotice').value="";
				html.push('<span onclick="$(\'#topnotice\').hide()"><a href="#">x</a></span>');
				if(data.num10>0){
					html.push('<p><a href="javascript:Cn_Index.clearnum(10,\'../acl/modifyuser.html\');" >有'+data.num10+'元返利成功</a></p> ');
				}
				if(data.num7>0){
					html.push('<p><a href="javascript:Cn_Index.clearnum(7,\'../front/mypl.html\');" >'+data.num7+'条最新评论</a></p> ');
				}
				if(data.num8>0){
					html.push('<p><a href="javascript:Cn_Index.clearnum(8,\'../front/sixin.html\');" >'+data.num8+'条私人短信</a></p> ');
				}
				if(data.num9>0){
					html.push('<p><a href="javascript:Cn_Index.clearnum(9,\'../front/myat.html\');" >'+data.num9+'条提到了你</a></p> ');
				}
				if(data.num1>0){
					html.push('<p><a href="javascript:Cn_Index.clearnum(1,\'../front/friend.html?type=3\');" >'+data.num1+'位好友关注了您</a></p>');
				}
				if(data.num2>0){
					html.push('<p><a href="javascript:Cn_Index.clearnum(2,\'../front/myact.html?t=2_2\');" >'+data.num2+'个活动邀请您参加</a></p>');
				}
				if(data.num4>0){//申请的TAB页
					html.push('<p><a href="javascript:Cn_Index.clearnum(4,\'../front/myact.html?t=1_3\');" >'+data.num4+'人响应您的活动</a></p>');
				}
				if(data.num5>0){//同意通过参加
					html.push('<p><a href="javascript:Cn_Index.clearnum(5,\'../front/myact.html?t=2_1\');" >最新同意你的申请'+data.num5+'</a></p>');
				}
				/*
				if(data.num3>0 || data.num4>0){
					var num = parseInt(data.num3)+parseInt(data.num4);
					html.push('<p><a href="myact1.html?t=2" onclick="Cn_Index.clearnum(3);Cn_Index.clearnum(4)" >'+data.num3+'人想加入您的活动');
					if(data.num4>0){
						html.push('/响应'+data.num4);
					}
					html.push('</a></p>');
				}*/
				//if(data.num4>0){
				//	html.push('<a href="myact.html?t=2" target="blank">最新申请您的活动'+data.num4+'</a><br>');
				//}
				//这部分也许用私信比较好  太多内容 增加了用户识别思考成本
				/*
				if(data.num6>0){
					html.push('<a href="myact.html?t=3_4" target="blank">最新拒绝您参加的活动'+data.num6+'</a><br>');
				}
				*/
				if(html.length>1){
					Jes.html('topnotice',html);
					Jes.show('topnotice');
				}else{
					Jes.hide('topnotice');
				}
			});	
		}
	}
	,toptip : function(){
		var url = window.location.href;
		if(url.indexOf('index.html')==-1&&url.indexOf('guang.html')==-1)return;
		if(Jes('tipcon')==null)return;
		var html = '';
		//1.邮箱激活
		try{
			if(userInfo.status=='0'){
				html = '<p>亲，注册已成功，赶紧登录邮箱去激活吧。</p>';
			}else if(userInfo.sex==null){
				html = '<p>亲，<a href="javascript:void(0);" onclick="window.open(\'../acl/modifyuser.html\');">完善下信息</a>吧,让更多人能认识你。</p>';
			}else if(userInfo.pic=='cuniao.jpg'){
				html = '<p>亲，赶紧<a href="javascript:void(0);" onclick="window.open(\'../acl/modifyuser.html\');">上传头像</a>吧,让更多人能认识你。</p>';
			}
			if(html.length>1){
				Jes.html('tipcon',html);
			    Jes('toptip').style.display='block';
			}		
		}catch(e){
			null;
		}
	}
	/*
	所有推荐机制分两种
	1.主动推荐  簇鸟推荐
	2.通过SNS推荐  你的好友做了什么
	*/
	//右侧推荐好友	Comm.indAct('indAct',6);
	,rightRecommUser : function(el1,el2,afterAction){
		if(afterAction==null)afterAction='Comm.rightRecommUser(\''+el1+'\',\''+el2+'\')';
		if(el1==null)el1='indUser';
		if(el2==null)el2='recommUser';
		if(Jes.userSess()){
			Comm.indUser(el1,6,afterAction);
		}else{
			Comm.recommRightUser(el2,6,afterAction);
		}
	}
	,cnRecommUser : function(el,num){
		Jes.doSaveTObject('cn.recomuser',{isLoad:false,'isSess':0}, function(data) {
			var html ='<table width="100%" border="0" cellpadding="0" cellspacing="0">';
			for(var i=0;i<data.length;i++){
				if(i==num){break;}
				var doub = (i+1)%2?false:true;
				if(!doub){html += '<tr>';}
				html += Comm._cnRecommUserHtml(data[i]);
				if((i+1)==data.length||doub){html += '</tr>';}
			}
			html += '</table>';
			Jes.html(el,html);
		});
	}
	//最新的活动
	,recentAct : function(el,num){
		if(el==null)el='recentact';
		if(num==null)num=6;
		Jes.query('lgact_query_sql@idx',{isLoad:false,'isSess':0},function(data){
			var html='';
			for(var i=0;i<data.length;i++){
				if(i>=num)break;
				html += Comm._recentActHtml(data[i]);
			}
			Jes.html(el,html);
			Jes.show('div'+el);
		});
	}
	/*
	el1  divname
	el2  divname
	*/
	//右侧活动推荐
	,rightRecommAct : function(el1,el2){
		if(el1==null)el1='indAct';
		if(el2==null)el2='recentact';
		if(Jes.userSess()){
			Comm.indAct(el1,6);
			Comm.recommAct(el2,6);
		}else{
			Comm.recommAct(el2,6);
		}
	}
	//簇鸟根据算法推荐的活动
	//目前只是用了最新活动
	,recommAct : function(el,num){
		Comm.recentAct(el,num);
	}
	,recommRightUser : function(el,num,afterAciton){
		var html ='';
		Jes.doQueryList('cnrecommuser_query_sql@idx',{isLoad:false,'isSess':0}, function(data) {
			for(var i=0;i<data.length;i++){
				if(i==num){break;}
				html += Comm._recommRightUserHtml(data[i],afterAciton);
			}
			Jes.html(el,html);
			Jes.show('div'+el);
		});
	}
	//sns推荐活动  你的好友参加了哪些活动
	,indAct : function(el,num){
		if(el==null)el='indAct';
		if(num==null)num=6;
		Jes.doQueryList('induseract_query_sql@idx',{isLoad:false,'isSess':0}, function(data) {
			var html ='';
			for(var i=0;i<data.length;i++){
				if(i==num){break;}
				html += Comm._indActHtml(data[i]);
			}
			if(html!=''){
				Jes.html(el,html);
				Jes.show('div'+el);
			}
		});
	}
	//大图显示用户
	,userBig : function(el,num,afterAction){
		if(num==null)num='8';
		Jes.doQueryList('userbig_query_sql@idx',{paraObj:"{limitnum:'"+ num +"'}",isLoad:false,'isSess':0},function(data){
			var html ='<table width="100%" border="0" cellpadding="0" cellspacing="0">';
			for(var i=0;i<data.length;i++){
				var doub = (i+1)%2?false:true;
				if(!doub){html += '<tr>';}
				html += Comm._userBigHtml(data[i],afterAction);
				if((i+1)==data.length||doub){html += '</tr>';}
			}
			html += '</table>';
			if(data.length>0){
				Jes.html(el,html);
				Jes.show('div'+el);
			}
		});
	}
	//推荐好友算法
	,recommDbUser : function(){
		Jes.doSaveTObject('cn.recomuser',{isLoad:false,'isSess':0}, function(data) {
			return data;
		});
	}
	//好友间接关注的用户
	,indUser : function(el,userNum,afterAction){
		if(!Jes.userSess(1)) return;//session
		Jes.doQueryList('induser_query_sql@idx',{isLoad:false},function(data){
			var html ='';
			for(var i=0;i<data.length;i++){
				if(i>=userNum){break;}
				html += Comm._indUserHtml(data[i],afterAction);
			}
			if(html!=''){
				Jes.html(el,html);
				Jes.show('div'+el);
			}
		});
	}
	// 初始化分组页面
    ,initGroup : function(fuserid, fuserloginid) {
        Jes('fuserid').value = fuserid;
        Jes.html('fuserlongid',fuserloginid);
        Jes.doQueryList('cngroup_query_sql@idx',{paraObj:"{userid:'"+ userInfo.userid +"'}",isLoad:false},function(data){
        	var html = [];
            for (var i = 0; i < data.length; i++) {
                html.push('<li><a href="javascript:void(0);"><input type="checkbox" value="' + data[i].id + '">' + data[i].name + '</a></li>')
            }
            Jes.html('option_groups',html);
        });
        //Cn_Index.showDiv('#showDiv4');
    }
	//最新注册用户
	,newestUser : function(el,page){
		var page = page || 0;
		if(Jes('tpage')!=null&&Jes('tpage')!=''){
			if(Jes('tpage').value!=null){
				if(page>=Jes('tpage').value){
					page = 0;
				}
			}
			Jes('npage').value= page;
			var pageSize = pageSize|| 10;
			Jes.page('newestuser_query_sql@idx',{isLoad:false,page:page*pageSize,pageSize:pageSize},function(data){
				Jes('tpage').value = data.totalPages;
				var data = data.pageList;
				var html = '';
				for(var i=0;i<data.length;i++){
					html += Comm._newestUser(data[i],i);
				}
				Jes.html(el,html);
			});
		}
	}
	//系统通知
	,sysInform : function(content,userId,busId,title){
		if(userId==null||userId==''){
			if(busId!=null&&busId!=''){
			Jes.query('getuserBybusid_query_sql@bus',{paraObj:"{busid:'"+ busId +"'}",isLoad:false},function(data){
				if(data.length==0)return;
				userId = data[0].id;
				if(title==null&&title=='')title = '系统通知';
				Jes.save('CnMsg',{param:{'userid':'1','username':title,'title':title,'status':'1','fuserid':userId,'content':content}},function(data){
					return '1';
				})
			});
			}else{
				return;
			}
		}else{
			if(title==null&&title=='')title = '系统通知';
			Jes.save('CnMsg',{param:{'userid':'1','username':title,'title':title,'status':'1','fuserid':userId,'content':content}},function(data){
				return '1';
			})
		}
	}
	//加关注
	,doGz : function(uid) {
		if(!Jes.userSess(1)) return;
		if(uid==userInfo.userid){
			Jes.alert("关注他人总比关注自己更好");
			return;
		}
		Jes.doSaveTObject('cn.guanzhu',{param:{'fuserid':uid},isLoad:false},function(data){
            //Comm.initGroup(uid);
		});
		alert('关注成功');
	}
	//取消关注	
	,qxgzshow : function(obj,fuserid){
		Jes.showDiv(obj);
		Jes('fuserid').value = fuserid;
	}
	//取消关注操作
	,removeGz : function(){
		Jes.doSaveTObject('cn.removeguanzhu',{param:{'fuserid':Jes('fuserid').value}},function(data){
			Jes.hide('hidegz1');
		});
	}
	//取消特殊关注
	,doTsgz : function(el,uid){
		if(!Jes.userSess(1))return;
		Jes.query('isgz_query_sql@idx',{paraObj:"{userid:'"+uid+"'}"},function(data){
			if(data==''){//还没加关注的
				Comm.doGz(uid);
			}
			if(data[0].name=='特别关注'){
				Jes.executeSql({ids:userInfo.userid,uid:uid,sql:'deltbgz_update_sql'},function(){
					$('#'+el).removeClass('tsgz');
					$('#'+el).addClass('notsgz');
					Jes(el).title="添加到特别关注";
				});
			}else{
				Jes.executeSql({ids:userInfo.userid,uid:uid,sql:'addtbgz_update_sql'},function(){
					$('#'+el).removeClass('notsgz');
					$('#'+el).addClass("tsgz");
					Jes(el).title="删除特别关注";
				});	
			}
		});
	}
	//TA还关注了谁
	,queryHerFollow : function(uid){
		if(!Jes.userSess())return;
		if(Jes('herfollow_npage')!=null)var page = Jes('herfollow_npage').value || 0;
		if(Jes('herfollow_tpage')!=null&&Jes('herfollow_tpage')!=''){
			if(Jes('herfollow_tpage').value!=null){
				if(page>=Jes('herfollow_tpage').value){
					page = 0;
				}
			}
			Jes('herfollow_npage').value= page;
			var pageSize = pageSize|| 10;
			Jes.page('herfollow_query_sql@idx',{paraObj:'{userid:\''+uid+'\'}',page:page*pageSize,pageSize:pageSize,isLoad:false,isSess:0},function(data){
				Jes('herfollow_tpage').value = data.totalPages;
				var data = data.pageList;
				var html='';
				for(var i=0;i<data.length;i++){
					html += Comm._newestUser(data[i],i);
				}
				Jes.html('herfollow',html);
				if(data.length>0)Jes.show('divherfollow');
				if(data.length>10)Jes.show('divherfollowmore');
			});
		}
	}
	//官方活动 图片+文字
	,officialAct : function(){
		Jes.query('officialact_query_sql@idx',{isLoad:false},function(data){
			var html= '';
			for(var i=0;i<data.length;i++){
				if(i==3)break;
				html += Comm._officialActHtml(data[i]);
			}
			if(data.length>0){
				Jes.show('gfbox');
				Jes.html('container',html);
				new Youa("gfbox");
			}
		});
	}
	//官方活动	图片	tabdiv
	,officImgShow : function(){
		Jes.query('officialact_query_sql@idx',{isLoad:false},function(data){
			for(var i=0;i<data.length;i++){
				if(i==2)break;
				img[i+1] = CONFIG_DATA.path + data[i].actpic;
				url[i+1] = '../act/actview.html?id='+data[i].id;
			}
			if(data.length>0){
				Comm.ImageShow();
				Jes.show('offic_img');
			}else{
				Jes.hide('offic_img');
			}
		});
	}
	,ImageShow : function() {
		var html = '<div class="picshow_main"><img src="../themes/default/images/sd03.png" width="83" height="85" class="sd_gftj">'
			+'<div><a id="url"><img id="pic" class="imgbig"  onload="return imgzoom(this,600);"  style="cursor:pointer;"/></a></div><div class="picshow_change">';
		for ( var i = 0; i < counts; i++) {
			html += '<a href="javascript:Comm.changeimg(' + (i + 1)
					+ ');" id="xxjdjj' + (i + 1)
					+ '" class="axx" target="_self"><img src="' + smallImg[i]
					+ '" onload="return imgzoom(this,600);"  style="cursor:pointer;"/></a>';
		}
		html += '</div></div>';
		Jes.html('offic_img',html);
		Comm.change_img();
	}
	,change_img : function () {
		if (key == 0) {
			key = 1;
		} else if (document.all) {
			document.getElementById("pic").filters[0].Apply();
			document.getElementById("pic").filters[0].Play(duration = 2);
		}
		eval('document.getElementById("pic").src=img[' + nn + ']');
		eval('document.getElementById("url").href=url[' + nn + ']');
		if (nn == 1) {
			document.getElementById("url").target = "_blank";
			document.getElementById("url").style.cursor = "pointer";
		} else {
			document.getElementById("url").target = "_blank"
			document.getElementById("url").style.cursor = "pointer"
		}
		for ( var i = 1; i <= counts; i++) {
			document.getElementById("xxjdjj" + i).className = 'axx';
		}
		document.getElementById("xxjdjj" + nn).className = 'bxx';
		nn++;
		if (nn > counts) {
			nn = 1;
		}
		tt = setTimeout('Comm.change_img()', 8000);
	}
	,changeimg : function (n) {
		nn = n;
		window.clearInterval(tt);
		Comm.change_img();
	}
	//取个人标签
	,getPersonTag : function(el,userid){
		var myhtml ='',usertag='',isShow=false;
		Jes.doQueryList('usertagid_query_sql@idx',{paraObj:'{userid:"'+userid+'"}',isLoad:false,isSess:0},function(redata){
			usertag = redata[0].tag;
			Jes.doQueryList('usertag_query_sql@user',{'isSess':0,isLoad:false},function(data){
				for(var i=0;i<data.length;i++){
					if(usertag!=null&&usertag!=''&&usertag.indexOf(','+data[i].tagid + ',')!=-1){
						isShow = true;
						myhtml += '<span>'+data[i].tagname+'</span>&nbsp;|&nbsp;';
					}
				}
				if(isShow){
					myhtml = myhtml.substr(0,myhtml.length-7);
					Jes.html(el,myhtml);//个人标签
					Jes.show('div'+el);
				}
			});
		});
	}
	//取所有标签
	,getTag : function(){
		var html ='<dd>',myhtml ='<dd>',usertag='';
		Jes.doQueryList('usertagid_query_sql@idx',{paraObj:'{userid:"'+userInfo.userid+'"}',isLoad:false},function(redata){
			usertag = redata[0].tag;
			Jes('tagid').value = usertag;
			Jes.doQueryList('usertag_query_sql@user',{'isSess':0,isLoad:false},function(data){
				for(var i=0;i<data.length;i++){
					//解析用户个人标签
					if(usertag!=null&&usertag!=''&&usertag.indexOf(','+data[i].tagid + ',')!=-1){
						myhtml += Comm._getmytagHtml(data[i].tagid,data[i].tagname);
					}else{
						html += Comm._gettagHtml(data[i].tagid,data[i].tagname);
					}
				}
				Jes.show('divmytag');
				Jes.html('mytag',myhtml+'</dd>');//个人标签
				Jes.html('tag',html+'</dd>');//所有标签
			});
		});
	}
	//新增标签
	,addTag : function(tagName){
		Jes.query('findbytagname_query_sql@idx',{paraObj:"{tagname:'"+ tagName +"'}",isLoad:false},function(data){
			if(data==null||data==''||data.length==0){//不存在就新增
				Jes.query('findmaxtagid_query_sql@idx',{paraObj:"{tagname:'"+ tagName +"'}",isLoad:false},function(data){
					var maxtagid = parseInt(data[0].tagid) + 1;//取最大ID
					Jes.save('CnUsertag',{param:{'tagname':tagName,flag:'1',num:0,tagid:maxtagid}},function(data){
						Comm.setTag('',maxtagid,tagName);
					});
				});
			}else{
				null;
			}
		});
	}
	//设置个人标签
	,setTag : function(obj,id,name){
		//判断是否已经添加
		Jes.syn(userInfo.userid);
		if(!Jes.userSess(1)) return;
		Jes('tagid').value = userInfo.tag;
		var j =Jes('tagid').value.split(',');
		if(parseInt(j.length)>11){alert('最多十个标签,选择最适合你的标签吧');return;}else{
		Jes.doQueryList('isexittag_query_sql@user',{paraObj:'{tagid:",'+id+',"}'},function(data){
			if(data[0].num>0){
				alert("你已经添加过此标签");
			}else{
				Comm.updatetag(obj,id,name);
			}
		});
		}
	}
	,updatetag : function(obj,id,name){
				Jes.executeSql({ids:userInfo.userid,tag:id+',',sql:'usertag_update_hql'},function(){
					Jes.syn(userInfo.userid);
					Jes('tagid').value = userInfo.tag;
					Comm.getTag();
				})
	}
	//删除个人标签
	,deleteTag : function(obj,id,name){
		Jes.executeSql({ids:userInfo.userid,tagid:','+id+',',sql:'deltag_update_hql'},function(){
			obj.parentNode.removeChild(obj);
			Jes.syn(userInfo.userid);
			var html = '<span onclick="javascript:Comm.setTag(this,'+id+',\''+name+'\')"><a href="#" ><span class="ico_delete" >＋</span>'+name+'</a>&nbsp; &nbsp;</span>';
			if(Jes('tag').innerHTML.indexOf(name)==-1){
				Jes('tag').innerHTML = Jes('tag').innerHTML.replace('</DD>','')+html+'</dd>';
			}
		})
	}
	//图片的放大缩小
	,changeImg : function(el){
		var classname = el.className;
		var image=new Image();
        image.src = el.src;;
		if(classname=='imgthu'){
        	Jes.Upload.drawImage(image,450,450);
			$(el).removeClass('imgthu');
			$(el).addClass('imgview');
		}else{
        	Jes.Upload.drawImage(image,130,130);
			$(el).removeClass('imgview');
			$(el).addClass('imgthu');
		}
		el.width = image.width;
        el.height = image.height;
	}
	/*******************************************************************************************************************************/
	/*****************************************************拼装HTML**********************************************************/
	/*******************************************************************************************************************************/
	
	
	
	
	//个人标签
	,_getmytagHtml : function(tagid,tagname){
		var html = '<span onclick="Comm.deleteTag(this,'+tagid+',\''+tagname+'\')" ><a href="javascript:void(0);">'+tagname+'<span class="ico_delete">X</span></a>&nbsp; &nbsp;</span>';
		return html;
	}
	,_gettagHtml : function(tagid,tagname){
		var html = '<span onclick="Comm.setTag(this,'+tagid+',\''+tagname+'\')"><a href="javascript:void(0);"><span class="ico_add">＋</span>'+tagname+'</a>&nbsp; &nbsp;</span>';
		return html;
	}
	//逛逛推荐活动
	,_guangActHtml : function(data,isEnd){
		var html ='';
  	  	html='<table width="100%" border="0" cellspacing="0" cellpadding="0" class="ping3" id="guangact">'
                  +'<tr>'
                   +'<td width="160" rowspan="3" align="left" class="hdimg"><a href="../act/actview.html?id='+data.id+'"><img src= "'+CONFIG_DATA.path+data.actpic+'"/></a></td>'
                   +'<td width="330" ><span class="gray2">'+Jes.getDateStrMoonDay(data.acttime)+' '+Jes.getTimeWeekStr(data.acttime)+ ' '+data.acthour + ':00   '+data.money+'元</span></td>'
                   +' <td><input name="input22" type="button" class="btn_hdbm" onclick="window.location.href=\'../act/actview.html?id='+data.id+'\';" /></td>'
                 +' </tr>'
                 +' <tr>'
                  +'  <td><a href="../act/actview.html?id='+data.id+'" class="gray1">'+Jes.getsub(data.content,21)+'</a></td>'
                  +'  <td width="60">人数<span class="bigred2">'+data.factnum+'/'+data.maxnum+'</span></td>'
                 +' </tr>'
                 +' <tr>'
                  +'  <td class="cjhd" colspan="2"><ul>';
	          if(data.actusers!=null&&data.actusers!=''){
			  	 	us = data.actusers.split(',');
			  	 	var i=0;
				 	Jes.each(us,function(j){
						i++;
						if(i==7)return false;
						var _u = us[j].substring(1,us[j].indexOf(':')),_p = us[j].substring(us[j].indexOf(':')+1,us[j].length-1);
						html += '<li><a href="person.html?uid='+_u+'"><img title="" src="' + Jes.getPicPath(_p) + '"/></a></li>';
					});
				}else{
					html += '<li><a href="../act/actview.html?id='+data.id+'" title="欢迎加入"><img src="/cuniao/cuniao/themes/default/images/han.jpg"/></a></li>';
				}
              html += '   </ul></td>'
                   +' '
                 +' </tr>'
         +' </table>';
	    if(!isEnd){
	    	html = '<div class="hdping3" >'+ html +'</div>';
	    }
	    return html;
	}
	//官方活动 海报+文字
	,_officialActHtml : function(data){
		var html='',content,address;
		if(data.content.length<30){content=data.content;}else{content=data.content.substr(0,30)+'...'};
		if(data.address.length<16){address=data.address;}else{address=data.address.substr(0,16)+'...'};
		html='<div class="item">'
				+'<a class="icon_closel" title="删除"  onClick="showhid2(\'gfbox\');"></a>'
			+'<div class="pic">'
				+'<a  href="../act/actview.html?id='+data.id+'"><img src="'+CONFIG_DATA.path+data.actpic+'"/></a>'
			+'</div>'
			+'<div class="txt">'
			    	+'<h3><a  href="../act/actview.html?id='+data.id+'"><label>【官方推荐】</label><span>'+content+'</span></a></h3>'
			    //	+'<p><label>活动标签：</label><span class="tag">80后</span></p>'
			        +'<p><label>开始时间：</label><span>'+data.acttime+'</span></p>'
			        +' <p><label>结束时间：</label><span>'+data.endtime+'</span></p>'
			        +'<p><label>地点：</label><span>'+ address +'</span></p>'
          	+'	<div class="imghead"><a href="../act/actview.html?id='+data.id+'">';
          	if(data.actusers!=null&&data.actusers!=''){
				us = data.actusers.split(',');
				Jes.each(us,function(j){
					var _u = us[j].substring(1,us[j].indexOf(':')),_p = us[j].substring(us[j].indexOf(':')+1,us[j].length-1);
					html += '<img src="' + Jes.getPicPath(_p) + '" width="35" height="35"/>';
				});
			}
	     html+='    </a></div>'
          +'	</div>'
         +' </div>';
		return html;
	}
	//官方活动 海报+文字
	,_officialActHtml_bak : function(data){
		var feetype='',html=[];
		if(data.feetype=='0'){feetype='免费'}
		if(data.feetype=='1'){feetype='免费'}
		if(data.feetype=='2'){feetype='AA制'}
		if(data.feetype=='3'){feetype='线下支付'}
		html.push('<a class="icon_closel" title="删除" onclick="showhid2(\'gftj\');"></a>');
		html.push('<a href="../act/actview.html?id='+data.id+'" class="aimg" title="点击查看详情"><img src="'+CONFIG_DATA.path+data.actpic+'" width="280" height="125"/></a>');
		html.push('<div class="gfrcon ');
			//<!--纯文字引用gftext样式,含头像引用gfhead样式-->
			if(data.factnum>3){html.push(' gfhead')}else{html.push(' gftext')}
			html.push('"><h3><label>【官方推荐】</label><span>'+data.content+'</span></h3>');
					html.push('<p><label>活动时间：</label><span>'+data.acttime+'</span></p>');
					html.push('<p><label>地址：</label><span>'+data.address+'</span></p>');
					if(data.factnum<=3){
						var leftnum = parseInt(data.maxnum) - parseInt(data.minnum);
						html.push('<p class="ye"><label>剩余名额：</label><span>'+ leftnum +'</span></p>');
					}
					html.push('<p class="fy"><label>活动费用：</label><span>'+feetype+'</span></p>');
					html.push('<div class="imghead">');
						html.push('<div>');
						if(data.actusers!=null&&data.actusers!=''){
						us = data.actusers.split(',');
						Jes.each(us,function(j){
							var _u = us[j].substring(1,us[j].indexOf(':')),_p = us[j].substring(us[j].indexOf(':')+1,us[j].length-1);
							html.push('<img src="' + Jes.getPicPath(_p) + '" width="35" height="35"/>');
						});
						}
						html.push('</div>');
					html.push('</div>');
				html.push('</div>');
		return html;
	}
	,_recentActHtml	: function(data){
		var html='';
	    html += '<table width="100%" border="0" cellspacing="2" cellpadding="0" class="hd_zzfqtb2">';
        html += '<tr><td width="40" rowspan="2"><a href="../act/actview.html?id='+data.id+'"><img class="pic" src= "'+CONFIG_DATA.path + data.actpic+'"/></a></td>';
        html += '<td>活动时间:'+data.acttime+'</td><td width="50" align="right">'+data.city+' </td></tr><tr>';
        html += '<td colspan="2"><a href="../front/person.html?uid='+data.userid+'" class="redh">'+data.loginid+'：</a>';
        if(data.actpro!='2'){
           	html += '<a href="../act/actview.html?id='+data.id+'">'+data.content+'</a>';
        }else{//私人
           	html += '<span>发起了一条<span style="color:red">私人的聚会</span>,只有被邀请人可见。</span>';
        }
        html += '</td></tr></table>';
		return html;
	}
	,_indActHtml : function(data){
		var html='';
		html +='<div class="hd_sjgz">';
        html +='	<div class="sjgz_lf">';
        html +='	<a href="../act/actview.html?id='+data.id+'" class=" pinglimg type'+data.createtype+'"><img width="200" src="'+ CONFIG_DATA.path + data.actpic +'" /></a>';
        html +='    </div>';
        html +=' 	<div class="sjgz_rg">';
        html +='      	<a href="../act/actview.html?id='+data.id+'"><p class="title" style="color:black">'+data.content+'</p></a>';
         html +='         <a href="../act/actview.html?id='+data.id+'"><span style="background:#FA0B0D;color:#FFF;text-decoration:none;">去看看>></span></a>';
          html +='    	<p class="sjgz_down">有<span>'+data.num+'</span>位好友已参加<a href="javascript:void(0);" onclick=\'Jes.showhidediv("hidegz'+data.id+'");\'></a></p>';
            html +='    </div>';
         html +=' <div class="hidegzxx" id="hidegz'+data.id+'" style="display:none;">';
          html +='	<div class="gzcon"><p>我的好友中有：';
		var userid = data.actuserid.split(',');
        var loginid = data.loginid.split(',');
             for(i=0;i<userid.length;i++){
             	if(i==4){break;}
             	html += '<a href="../front/person.html?uid='+userid[i]+'">'+loginid[i]+'</a>';
             }
         html +='   等已参加</p></div>';
        html +='  </div>';
        html +='</div>';
        return html;
	}
	,_newestUser : function(data,i){
		var html = '';
		html += '<li class="mbtr">';
		html += '<div class="add_pic" onmouseover="Comm.namecardshow(\''+ data.id+'\',\'gz_'+i+'\');" onmouseout="Comm.namecardhide(\'gz_'+i+'\');">';
		if(data.type=='1'){
			html += '<a href="../front/person.html?uid='+data.id+'">';
		}else{
			html += '<a href="../front/indexbus.html?uid='+data.id+'">';
		}
		html += '<img src="'+Jes.getPicPath(data.pic)+'" alt="'+data.loginid+'" title="'+data.loginid+'" /></a>';
		html += '<div id="gz_'+i+'"></div></div><span onclick="Cn_Index.rightdogz(this,\''+data.id+'\',\''+data.loginid+'\');"><a href="javascript:void(0)" style="color:red" align="center">+ 加关注</a></span></li>';
		return html;
	}
	,_recommRightUserHtml : function(data){
		var html = '';
		html +='<div class="hd_sjgz">';
        html +='	<div class="sjgz_lf">';
        html +='	<a href="../front/person.html?uid='+data.id+'" class=" pinglimg type1"><img src="'+Jes.getPicPath(data.pic)+'" /></a>';
        html +='    </div>';
        html +=' 	<div class="sjgz_rg">';
        html +='      	<a href="../front/person.html?uid='+data.id+'"><p class="title" style="color:red">'+data.loginid+'</p></a>';
        html +='         <a href="javascript:Comm.doGz(\''+data.id+'\');"><span style="background:#FA0B0D;color:#FFF;text-decoration:none;">加关注</span></a>';
        html +='    	<p class="sjgz_down">活跃用户<a href="javascript:void(0);" ></a></p>';
        html +='    </div>';
        html +='</div>';
        return html;
	}
	//好友间接关注的用户/商家
	,_indUserHtml : function(data,afterAction){
		var html='',url='',addhtml='',title='',utype='';
		if(data.type=='1') {
			url='href="../front/person.html?uid='+data.userid+'"'; 
			utype = '1';
		}else{ 
			url='href="../front/indexbus.html?uid='+data.userid+'"';
			utype='0';
		}
		if(data.type=='0'){addhtml = '<a '+url+'><span class="name" style="color:blue" title="商家">'+data.loginid+'</span></a>';}
        if(data.type=='2'){addhtml = '<a '+url+'><span class="name vip" style="color:blue" title="认证商家">'+data.loginid+'</span></a>';}
        if(data.type=='1'){addhtml = '<a '+url+'><span class="name" style="color:red" >'+data.loginid+'</span></a>';}
		html +='<div class="hd_sjgz">';
        html +='	<div class="sjgz_lf">';
        html +='	<a  class="pinglimg type'+utype+'"  '+url+'  ><img src="'+Jes.getPicPath(data.pic)+'" /></a>';
        html +='    </div>';
        html +=' 	<div class="sjgz_rg">';
         html += 		addhtml;
         html +=		'&nbsp;&nbsp;<a href="javascript:Comm.doGz(\''+data.userid+'\');'+afterAction+'"><span style="background:#FA0B0D;color:#FFF;text-decoration:none;">加关注</span></a>';
          html +='    	<p class="sjgz_down">有<span>'+data.num+'</span>位好友关注他<a href="javascript:void(0);" onclick=\'Jes.showhidediv("hidegz'+data.userid+'");\'></a></p>';
            html +='    </div>';
         html +=' <div class="hidegzxx" id="hidegz'+data.userid+'" style="display:none;">';
          html +='	<div class="gzcon"><p>我的好友中有：';
         var userid = data.fuserid.split(',');
         var loginid = data.floginid.split(',');
             for(i=0;i<userid.length;i++){
             	if(i==4){break;}
             	html += '<a href="../front/person.html?uid='+userid[i]+'">'+loginid[i]+'</a>';
             }
         html +='   等关注他</p></div>';
        html +='  </div>';
        html +='</div>';
        return html;
	}
	,_cnRecommUserHtml : function(){
		
	}
	,_userBigHtml : function(data,afterAction){
		var html = '';
		html +='<td>';
		html += '	<div class="sbgglt"><a href="../front/person.html?id='+data.userid+'"><img src="'+Jes.getPicPath(data.pic)+'" name="'+data.loginid+'" class="type1" /></a></div>';
        html += '   <div class="sbggrg">';
		html += '	<a href="../front/person.html?id='+data.userid+'" class="title"><span style="color:red">'+data.loginid+'</span></a>';
        html += '   	<p class="miaoshu">'+data.sign+'</p>';
        html += '   	<p class="jgz">';
		html += '			关注<span id="">'+data.follownum+'</span> 被关注<span id="">'+data.fansnum+'</span> 活动<span id="">'+data.reqnum
						+ '</span><a href="javascript:Comm.doGz(\''+data.userid+'\');'+afterAction+'"><span style="background:#FA0B0D;color:#FFF;text-decoration:none;">加关注</span></a>';
		html += '		</p>';
        html += '   </div>';
        if(data.content!=null){
        	html += '<div class="rwcon">“'+data.content+'”</div>';
        }else{
        	html += '<div class="rwcon">我是活动达人,加我有惊喜</div>';
        }
		html += '</td>';
		return html;
	}
	//商家html解析
	,_busHtml : function(data,afterAction){
		var html = '';
		html +='<td width="50%">';
		html +='	<div class="sbgglt"><a href="../bus/busview.html?id='+data.id+'" ><img src="'+Jes.getPicPath(data.pic)+'" name="'+data.name+'" /></a></div>';
        html +='        <div class="sbggrg">';
		html +='		<a href="../bus/busview.html?id='+data.id+'" class="title">';
		if(data.usertype=='2'){
			html +='<span class="name vip" title="认证商家">'+data.name+'</span></a>';
		}else{
			html +='<span class="name" title="商家">'+data.name+'</span></a>';
		}
		html +='		<span class="sjcon">'+data.comment+'</span>';
		html +='	<p class="jgz">';
		html +='		<span id="">'+data.reqnum+'</span>人关注他 <a href="javascript:Comm.doGz(\''+data.id+'\');'+afterAction+'"><span style="background:#FA0B0D;color:#FFF;text-decoration:none;">加关注</span></a>';
		html +='	</p>';
        html +='    </div>';
		html +='</td>';
		return html;
	}
	//图片html
	,_imgHtml : function(topicpic){
		if(topicpic){
	        var srcurl = CONFIG_DATA.path+topicpic,ww,hh,w,h;
	       	var image=new Image();
	       	image.src = srcurl;
			if(image.width>130||image.height>130){
				w=image.width/130;
				h=image.height/130;
				if(w>h){
					ww=130;
					hh=image.height/w;
				}else{
					hh=130;
					ww=image.width/h;
				}
			}
	        return '<br/><img class="imgthu" onclick="Comm.changeImg(this)" width="'+ ww +'" height="'+ hh +'" src="'+srcurl+'"/>';
        }else{
        	return '';
        }
	}
	/*正文说说内容
	*da  数据集
	*i 序列id
	*type 来标识不同tab的namecard的id
	*/
	,_sayHtml : function(da,i,type){
		var isCreater = false,loginidHtml;//该记录是否是自己发起
        if(userInfo!=null){
       		if(da.tuserid==userInfo.userid){
        		isCreater = true;
        	}
        }
        if(isCreater){
        	loginidHtml = '<a href="javascript:void(0);" class="red14" >'+da.loginid+'</a>：';
        }else{
	        if(da.usertype=='0')loginidHtml = '<a href="./indexbus.html?uid='+da.tuserid+'" class="blue14" title="商家">'+da.loginid+'</a>：';
	        if(da.usertype=='2')loginidHtml = '<a href="./indexbus.html?uid='+da.tuserid+'" class="blue14 vip" title="认证商家">'+da.loginid+'</a>：';
	        if(da.usertype=='1')loginidHtml = '<a href="./person.html?uid='+da.tuserid+'" class="red14">'+da.loginid+'</a>：';        
        }
		var html ='<table width="100%" border="0" cellspacing="0" cellpadding="0" class="pingl">'
				+'<tr>'
                    +'<td width="75" rowspan="5" align="left" valign="top" onmouseover="Comm.namecardshow(\''+ da.tuserid+'\',\'top_'+da.topicid+ type +'\');" onmouseout="Comm.namecardhide(\'top_'+ da.topicid + type +'\');">';
	            if(isCreater){
	            	html += '<a href="javascript:void(0);" class="pinglimg" >';
	            }else{
	            	if(da.usertype=='1')html += '<a href="./person.html?uid='+da.tuserid+'" class="pinglimg" >';
	            	else html += '<a href="./indexbus.html?uid='+da.tuserid+'" class="pinglimg" style="border:1px solid #155FBE;" >';
	            }
	        
             html += '<img src= "'+ Jes.getPicPath(da.pic)+'"/></a><div class="head_pic" id="top_'+ da.topicid + type +'" ></div></td>'
                    +'<td></td>'
                  +'</tr>'
                  +'<tr><td>'
                  + loginidHtml + '<span class="gray1">'+da.content+ this._imgHtml(da.topicpic) +'</span>'
                  +'</td></tr>';
            
        //如果是转发
        if(da.zfid){
        	zfda = da.extList[0];
        	if(!zfda){
				html+='<tr>'
                    +'<td colspan="2"><div class="yiny">'
                        +'<div class="yinyt"></div>'
                        +'<div class="yinyc">原文已经删除</div>'
                        +'<div class="yinyb"></div>'
                      +'</div></td>'
                  +'</tr>';
        	}else{
        		if(zfda.type=='1'){
	        		html+='<tr>'
	                    +'<td colspan="2"><div class="yiny">'
	                        +'<div class="yinyt"></div>'
	                        +'<div class="yinyc"><a href="./plview.html?id='+da.zfid+'" class="gray3">@'+zfda.loginid+':  </a><span class="gray1">'
	                    	+ zfda.content + this._imgHtml(zfda.topicpic) + '</span> <br/> <span class="gray2" ><a href="./plview.html?id='+da.zfid+'" class="gray2">原文转发('+zfda.zfnum+')</a>| <a href="./plview.html?id='+da.zfid+'" class="gray2" >原文评论('+zfda.plnum+')</a></span></div>'
	                        +'<div class="yinyb"></div>'
	                      +'</div></td>'
	                  +'</tr>';
	        	}else if(zfda.type=='2'){//活动
	        		while(zfda.extra.indexOf('\r\n') >= 0)
    				zfda.extra = zfda.extra.replace('\r\n','\\r\\n');
	        		var act = eval("("+zfda.extra+")"),lnum=act.maxnum-act.factnum,feetype=CONFIG_DATA.FEETYPE[act.feetype]
	        		,time=Jes.formatDate(new Date(act.acttime),'2').replace('111','2011').substr(5),us = zfda.actusers.split(',');//活动详情
		     		//转发begin
		        	html+='<tr>'
	                    +'<td><div class="yiny">'
	                        +'<div class="yinyt"></div>'
	                        +'<div class="yinyc">'
	                          +'<table width="100%" border="0" cellspacing="0" cellpadding="0" class="zf_hdq">'
	                            +'<tr>'
	                              +'<td width="111" rowspan="3" align="left" class="hdimg"><a href="javascript:void(0);"><img onclick="window.location.href=\'../act/actview.html?id='+act.id+'\';" src= "'+ CONFIG_DATA.path+act.actpic+'"/></a></td>'
	                              +'<td><span class="gray2">'+time+' '+act.acthour+'点  '+act.money+'元</span></td>'
	                              +'<td width="89" rowspan="3"><div class="tablenum"><a href="javascript:void(0);"><input name="input22" type="button" ';
	                var oo = new Date(Jes.formatDate(new Date(act.endtime))+' '+act.endhour+':00:00');
	                if(oo<= new Date()){
	                	html += 'class="btn_hdjs" ';
	                }else{
	                	if(lnum==0){
	                		html += 'class="btn_rsym" ';
	                	}else{
	                		html += 'class="btn_hdbm"  ';
	               	 	}
	                }
	                       html += ' value="" onclick="window.location.href=\'../act/actview.html?id='+act.id+'\'"/></a></div></td>'
	                            +'</tr>'
	                            +'<tr>'
	                              +'<td><a href="#" class="red14"></a>'+ loginidHtml +'<a href="../act/actview.html?id='+act.id+'" class="gray1">'+Jes.getsub(zfda.content,18-zfda.loginid.length)+'</a></td>'
	                             // +'<td >人数<span class="bigred2">'+act.factnum+'/'+act.maxnum+'</span></td>'
	                            +'</tr>'
	                            +'<tr>'
	                              +'<td class="cjhd"><ul>';
									Jes.each(us,function(j){
										var _u = us[j].substring(1,us[j].indexOf(':')),_p = us[j].substring(us[j].indexOf(':')+1,us[j].length-1);
										html +='<li onmouseover="Comm.namecardshow(\''+_u+'\',\'join_'+ da.topicid + _u + j + type +'\');" onmouseout="Comm.namecardhide(\'join_'
											+ da.topicid + _u + j + type +'\');"><img src= "'+Jes.getPicPath(_p)+'"/><div id="join_'+ da.topicid + _u + j + type +'"></div></li>';
									});
	                                html+='</ul></td>'
	                              +'<td >&nbsp;</td>'
	                            +'</tr>'
	                            +'<tr>'
	                              +'<td colspan="3" class="tablebot" width="530"><p style="float:left;"></p>' //倒计时
	                                +'<p style="float:right;"> <a href="../act/actview.html?id='+act.id+'" class="gray2">原文转发('+zfda.zfnum+')</a><span class="MIB_line_l">|</span> <a  href="../act/actview.html?id='+act.id+'" class="gray2">原文评论('+zfda.plnum+')</a></p></td>'
	                            +'</tr>'
	                            +'<tr>'
	                              +'<td colspan="4"></td>'
	                            +'</tr>'
	                          +'</table>'
	                        +'</div>'
	                        +'<div class="yinyb"></div>'
	                      +'</div></td>'
	                  +'</tr>';
	                  //转发end
	        	}
        	}
        }
                  html+='<tr>'
                    +'<td class="tablebot" colspan="3" width="530"><p style="float:left;">'+Jes.prettyDate(da.posttime.substr(0,19))+'</p>'
                      +'<p style="float:right;"> ';
                  if(userInfo!=null){
	                    if(da.tuserid==userInfo.userid){//只能删除自己的
	                  		html += '<a href="javascript:Cn_Index.delTopic('+i+');" class="gray2">删除</a><span class="MIB_line_l">|</span>';
	                  	}//说说取消收藏功能  <a href="javascript:Cn_Index.doFav('+i+');" id="fav'+i+'" class="gray2">收藏</a><span class="MIB_line_l">|</span>
                  }
                  
                  html +='<a href="javascript:Cn_Index.zfInit('+i+');" class="gray2">转发(<span id="zfnum_'+da.topicid+'">'+da.zfnum+'</span>)</a><span class="MIB_line_l">|</span><a href="javascript:Cn_Index.plInit('+i+','
                  	  	+ isCreater+');" class="gray2">评论(<span id="plnum_'+da.topicid+'">'+da.plnum+'</span>)</a></p></td>'
                  	  	+'</tr>'
                 	+'<tr>'
                   		+'<td height="8" colspan="2"><div id="'+da.objid+'"></div><div id="'+da.topicid+'"></div></td>'
                   +'</tr>'
                + '</table>';
		return html;
	}
	/*正文活动内容
	*da  数据集
	*i 序列id
	*type 来标识不同tab的namecard的id
	*/
	,_actHtml : function(da,i,type){
		type = type||1;
		var isCreater =false,loginidHtml='';//该记录是否是自己发起
		if(userInfo!=null){
			if(da.tuserid==userInfo.userid){
        		isCreater = true;
        	}
		}
		if(isCreater){
			loginidHtml = '<a href="javascript:void(0);" class="red14" >'+da.loginid+'</a>：';	
		}else{
			if(da.usertype=='0')loginidHtml = '<a href="./indexbus.html?uid='+da.tuserid+'" class="blue14" title="商家">'+da.loginid+'</a>：';
			if(da.usertype=='2')loginidHtml = '<a href="./indexbus.html?uid='+da.tuserid+'" class="blue14 vip" title="认证商家">'+da.loginid+'</a>：';
	        if(da.usertype=='1')loginidHtml = '<a href="./person.html?uid='+da.tuserid+'" class="red14">'+da.loginid+'</a>：';
		}
		while(da.extra.indexOf('\r\n') >= 0)
    	da.extra = da.extra.replace('\r\n','\\r\\n');
		var act = eval("("+da.extra+")"),lnum=act.maxnum-act.factnum,feetype=CONFIG_DATA.FEETYPE[act.feetype]
		//ff中年份显示是   111年
		,time=Jes.formatDate(new Date(act.acttime),'2').replace('111','2011').substr(5);
		var html ='<table width="101%" border="0" cellspacing="0" cellpadding="0" class="pingl">'
				  +'<tr>'
                    +'<td width="75" rowspan="3" align="left" valign="top" onmouseover="Comm.namecardshow(\''+da.tuserid+'\',\'top_'+da.topicid+ type +'\');" onmouseout="Comm.namecardhide(\'top_'+da.topicid+ type +'\');">';
                if(isCreater){
            		html += '<a href="javascript:void(0);" class="pinglimg" >';
            	}else{
            		if(da.usertype=='1'){
            			html += '<a href="./person.html?uid='+da.tuserid+'" class="pinglimg" >';
            		}else if(da.usertype=='0'||da.usertype=='2'){
            			html += '<a href="./indexbus.html?uid='+da.tuserid+'" class="pinglimg" style="border:1px solid #155FBE;" >';
            		}else {
            			html += '<a href="./person.html?uid='+da.tuserid+'" class="pinglimg" >';
            		}
            	}
         	var isHide = true;//默认不邀请
         	if(userInfo!=null){
	         	Jes.doSync(function(){//同步函数
					Jes.doQueryList('isyqr_query_sql@idx',{paraObj:'{actid:\''+da.objid+'\'}',isLoad:false},function(data){
					if(data[0].num=='0'){
						isHide= true;
					}else{
						isHide = false;
					}
					});
				});
         	}
         	html += '<img src= "'+Jes.getPicPath(da.pic)+'"/></a>';
            if(act.actpro=='2'&&isHide){//私人的聚会  当前不是邀请人  true= 没有被邀请 需要隐藏
				html += '<div class="head_pic" id="top_'+da.topicid+ type +'"></div>'
                    +'</td>'
                  +'</tr>'
                  +'<tr>'
                    +'<td>'+loginidHtml+'<span class="red14">正发起了一个私人的聚会,只有被邀请人才能看到。</span></td>'
                  +'</tr>'
                 +'</table>';
            }else{
                html += '<div class="head_pic" id="top_'+da.topicid+ type +'"></div><p></p></td>'
                    +'<td width="111" rowspan="3" align="left" class="hdimg"><a href="javascript:void(0);"><img onclick="window.location.href=\'../act/actview.html?id='+da.objid+'\'" src= "'+ CONFIG_DATA.path+act.actpic+'"/></a></td>'
                    +'<td ><span class="gray2">'+time+' '+act.acthour+'点  '+act.money+'元</span></td>'
                    +'<td width="89" rowspan="3"><div class="tablenum"><input name="input22" ';
                //var ii = '20'+act.acttime.year.toString().substring(1,3)+'-'+(act.act.time.month+1).toString()+'-'+act.acttime.date.toString()+' '+act.acthour.toString()+':00:00';
				var tt = Jes.formatDate(new Date(act.endtime)).substr(0,10).replace(/-/g,'/')+' '+act.acthour+':00:00';
				if(tt.indexOf('111')!=-1){
					tt = tt.replace('111','2011');
				}
				tt = new Date(Date.parse(tt));
				//判断状态
				if(da.flag=='1'){
					if(tt<= new Date()){
	                	html += 'class="btn_hdjs" ';
	                }else{
	                	if(lnum==0){
	                		html += 'class="btn_rsym" ';
	                	}else{
	                		html += 'class="btn_hdbm"  ';
	               	 	}
	                }
				}else{
					//待审核
					html += 'class="btn_hdbm"  ';
				}
                 html += ' onclick="window.location.href=\'../act/actview.html?id='+da.objid+'\'"/>';
                 if(tt >= new Date()){
                 	html += '<p>人数：<span class="bigred2">'+act.factnum+'/'+act.maxnum+'</span></p>';
                 }
                 html += '</div></td></tr>'
                  +'<tr>'
                    +'<td><a  href="javascript:void(0);" class="red14"></a>'+loginidHtml+'<a href=\'../act/actview.html?id='+da.objid+'\'" class="gray1">'+Jes.getsub(da.content,22)+'</a></td>'
                  + '</tr>'
                  +'<tr>'
                    +'<td class="cjhd"><ul>';
                  if(da.actusers!=null&&da.actusers!=''){
                  	var us = da.actusers.split(',')
					Jes.each(us,function(j){
							var _u = us[j].substring(1,us[j].indexOf(':')),_p = us[j].substring(us[j].indexOf(':')+1,us[j].length-1);
							html +='<li onmouseover="Comm.namecardshow(\''+_u+'\',\'join_'+ da.topicid + _u + j + type +'\');" onmouseout="Comm.namecardhide(\'join_'
								+ da.topicid + _u + j + type +'\');"><img src= "'+Jes.getPicPath(_p)+'"/><div id="join_'+ da.topicid + _u + j + type +'"></div></li>';
					});
                  }
                        html+='</ul></td>'
                    +'<td >&nbsp;</td>'
                  +'</tr>'
                  +'<tr>'
                    +'<td>&nbsp;</td>'
                    +'<td colspan="3" class="tablebot" width="530"><p style="float:left;">'+Jes.prettyDate(da.posttime.substr(0,19))+'</p>'
                      +'<p style="float:right;"><a href="javascript:Cn_Index.zfInit('+i+');" class="gray2">转发(<span id="zfnum_'+da.topicid+'">'+da.zfnum+'</span>)</a><span class="MIB_line_l">|</span><a href="javascript:Cn_Index.doFav('+i+');" id="fav'+i+'" class="gray2">收藏</a><span class="MIB_line_l">|</span><a href="javascript:Cn_Index.plInit('+i+','+isCreater+');" class="gray2">评论(<span id="plnum_'+da.topicid+'">'+da.plnum+'</span>)</a></p></td>'
                  +'</tr>'
                  +'<tr>'
                    +'<td colspan="4"><div id="'+da.objid+'"></div><div id="'+da.topicid+'"></div></td>'
                  +'</tr>'
                +'</table>';
            }
		return html;
	}
	/*namecard显示
	*userid  用户ID
	*topicid 要显示的divid
	*/
	,namecardshow : function(userid,topicid){
		if(!Jes.userSess())return;
		if(userInfo==null||userid==null)return;
		Comm.hideallcard();//隐藏其他namecard
		var nc = Jes(topicid).innerHTML;
		if(nc==null||nc==''){
			if(userid==userInfo.userid){//是我自己 就特殊显示
				Jes.query('namecardself_query_sql@idx',{paraObj:"{userid:'"+ userid +"'}",isLoad:false},function(data){
					var html=[];var data=data[0];
					html = Comm._showmyself(html,data);
					Jes.html(topicid,html);
					Jes(topicid).style.display ='block';
				});
			}else{
				Jes.query('namecard_query_sql@idx',{paraObj:"{userid:'"+ userid +"'}",isLoad:false},function(data){
					var html=[];var data=data[0];
					html = Comm._showHercard(html,data);
					Jes.html(topicid,html);
					Jes(topicid).style.display ='block';
				});
			}
		}else{
			Jes(topicid).style.display ='block';
		}
		__nameCardId = __nameCardId +','+ topicid;
	}
	//namecard hide
	,namecardhide : function(topicid){
		Jes(topicid).style.display ='none';
	}
	,hideallcard : function(){
		if(__nameCardId!=null&&__nameCardId!=''){
			var nameCard = __nameCardId.split(',');
			for(var i=0;i<nameCard.length;i++){
				if(Jes(nameCard[i]) == null){
					__nameCardId = __nameCardId.replace(','+nameCard[i],'');
				}else{
					if(nameCard[i]!=null&&nameCard[i]!=''&&Jes(nameCard[i]).style.display=='block'){//之前的还在显示 隐藏掉
					Comm.namecardhide(nameCard[i]);
					__nameCardId = __nameCardId.replace(','+nameCard[i],'');
					}
				}
			}
		}
	}
	,_showmyself : function(html,data){
		var single = Comm.dealSingle(data);
		html.push('<div class="add_pic_div" id="downdiv02" style="z-index:99">');
		html.push('<div class="details">');
		html.push('<div class="det_pic">');
		html.push('<img src="'+Jes.getPicPath(data.pic)+'" />');
		html.push('</div>');
		html.push('<div class="det_right">');
		html.push('<ul>');
		html.push('<li><span style = "color:red">'+data.loginid+'</span></li>');
    	html.push('<li>'+ single + data.area +'  '+ data.city +'</li>');
		html.push('<li>关注<span style = "color:red">'+data.follownum+'</span>被关注<span style = "color:red">'+data.fansnum+'</span>活动<span style = "color:red">'+data.reqnum+'</span></li>');
		html.push('</ul>');
		html.push('</div>');
		html.push('<div class="clear"></div>');
		html.push('</div>');
		html.push('<div class="introduction" style = "color:red">这是你自己</div>');
		html.push('</div>');
		return html;
	}
	,_showHercard : function(html,data){
		var single = Comm.dealSingle(data);
					if(data.type=='0'||data.type=='2'){//商家特殊显示
						html.push('<div class="add_pic_div" id="downmenu1" style="z-index:99"><div class="details"><div class="det_pic"><a style="border:1px solid #155FBE;" href="../front/indexbus.html?uid='
						+ data.id+'"><img src="'+Jes.getPicPath(data.pic)+'" title="商家"/></a></div><div class="det_right"><ul><li><a href="../front/indexbus.html?uid='+data.id+'" style="color:blue">'+data.loginid+'</a>');
					}else{
					html.push('<div class="add_pic_div" id="downmenu1" style="z-index:99"><div class="details"><div class="det_pic"><a href="../front/person.html?uid='+data.id+'"><img src="'+Jes.getPicPath(data.pic)+'" /></a></div>'+
						'<div class="det_right"><ul><li><a href="../front/person.html?uid='+data.id+'">'+data.loginid+'</a>');
					}
					if(data.isgz=='1'){
						if(data.remark==null||data.remark==''){
							html.push('<a href="javascript:void(0);" onclick="Jes.showDiv(\'#showDiv5\',\'fuserid\',\''+data.id+'\')">(添加备注)</a>');
						}else{
							html.push('<a href="javascript:void(0);" onclick="Jes.showDiv(\'#showDiv5\',\'fuserid\',\''+data.id+'\')">('+data.remark+')</a>');
						}
					}
					html.push('</li><li> '+ single +Jes.notnull(data.area)+'  '+Jes.notnull(data.city)+'</li><li><a href="javascript:void(0);">关注</a><span>'+data.follownum+
					'</span><a href="javascript:void(0);">被关注</a><span>'+data.fansnum+'</span><a href="javascript:void(0);">活动</a><span>'+data.reqnum+'</span></li></ul></div><div class="clear"></div></div>'+
					'<div class="introduction">'+Jes.notnull(data.sign)+'</div><div class="attention"><div class="att_left"><a href="javascript:void(0);" onclick="Jes.showDiv(\'#showDiv2\',\'fuserid\',\''+data.id+'\')">'+
					'私信</a>');
					if(data.isgz=='1'){
						if(data.tsgz=='特别关注'){
							html.push('<span>|</span><a href="javascript:Comm.doTsgz(\''+data.id+'tsgz\',\''+ data.id +'\');" style="hover {text-decoration:none;};visited {text-decoration:none;};" title="取消特别关注" id="'+data.id+'tsgz" class="tsgz" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a></div>');
						}else{
							html.push('<span>|</span><a href="javascript:void(0);" onclick="Comm.doTsgz(\''+data.id+'tsgz\',\''+ data.id +'\');" style="a:hover {text-decoration:none;};a:link {text-decoration:none;};a:visited {text-decoration:none;};" title="添加到特别关注" id="'+data.id+'tsgz" class="notsgz" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a></div>');
						}
						html.push('<div class="att_right">已关注<span>'+
						'|</span><a href="javascript:void(0);" onclick="Comm.qxgzshow(\'#hidegz1\',\''+data.id+'\')" >取消关注</a></div> <div class="clear"></div></div></div>');
					}else{
						html.push('</div>');
						html.push('<div class="att_right"><a href="javascript:void(0);" onclick="Cn_Index.doGuanzhu(\''+data.id+'\',\''+data.loginid+'\')">+加关注</a>'+
						'<div class="clear"></div></div></div>');
					}
		return html;
	}
	//处理单身性别html
	,dealSingle : function(data){
		var single ='';
		if(data.single==1){
	  		if(data.sex==1){
					single='<img src="../themes/default/images/ico_boy.gif" title="单身男" />';
				}else{
					single='<img src="../themes/default/images/ico_girl.gif" title="单身女" />';
				}
			}else{
				single='<img src="../themes/default/images/ico_friends.gif" title="不在单身" />';
			}	
		return single;
	}
	//活动详情页面 评论的HTML
	,_actPlunHtml : function(data,i){
		var html = '';
			html = '<li class="commentsCell" ';
				if(userInfo!=null&&(data.fqr==userInfo.userid||data.userid==userInfo.userid)){//活动发起人 才能删除
                	html += ' onmouseover="showhid(\'colse'+data.id+'\')" onmouseout="showhid2(\'colse'+data.id+'\')"';
                }
              html += 'style="z-index:'+(999-i).toString()+';" ><div class="commentsTxt"> <div class="compic" onmouseover="Comm.namecardshow(\''+data.userid+'\',\'namec'+data.id+'\')" onmouseout="Comm.namecardhide(\'namec'+data.id+'\')"> '
               +'<a href="../front/person.html?uid='+data.userid+'" title="'+data.loginid+'" class="comimg"><img width="40" height="40" class="picborder_l" title="'+data.loginid+'" src="'+Jes.getPicPath(data.pic)+'"/></a>'
               	+'<div id="namec'+data.id+'"></div></div>'
               	+'<div id="colse'+data.id+'" class="icon_closel" style="display:none;"  onclick="Cn_ActView.delActPlun(this,\''+data.id+'\',\''+data.topicid+'\')"title="删除"> x </div>'
                +'<div class="commentsContants">'
                  +'<p class="commentsParm"><a href="javascript:void(0);" class="textname">'+data.loginid+'</a> :'+data.content+'('+data.ctime+') </p>'
                  +'<div class="commentOption">';
                  if(userInfo!=null&&data.userid!=userInfo.userid){//不是本人就能回复
                  	  html += '<p class="rt"><a  href="javascript:Cn_ActView.reply(\''+data.loginid+'\',\''+data.userid+'\')" class="ico_reply" >回复</a> </p>';
                  }
                 html += '</div>'
                  +'<div class="clearit"></div>'
                +'</div>'
              +'</div>'
            +'</li>';
		return html;
	}
}